package com.jerry.common.exception;

import org.springframework.http.HttpStatus;

/**
 * Filename:    com.jerry.common.exception.RestException
 * Description:
 * Copyright:   Copyright (c)2017
 * Company:     lngtop
 *
 * @author: 谢余锋
 * @version: 1.0
 * Create at:   2017/3/6 下午5:16
 * <p/>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2017/3/6      谢余锋        1.0        1.0 Version
 */
public class RestException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    private HttpStatus status;
    private String errorCode;

    public RestException() {
        this.status = HttpStatus.INTERNAL_SERVER_ERROR;
        this.errorCode = "NOT_DATA";
    }

    public RestException(HttpStatus status) {
        this.errorCode = "NOT_DATA";
        this.status = status;
    }

    public RestException(String message) {
        super(message);
        this.status = HttpStatus.INTERNAL_SERVER_ERROR;
        this.errorCode = "NOT_DATA";
    }

    public RestException(HttpStatus status, String message) {
        super(message);
        this.errorCode = "NOT_DATA";
        this.status = status;
    }

    public RestException(HttpStatus status, String errorCode, String message) {
        super(message);
        this.status = status;
        this.errorCode = errorCode;
    }

    public HttpStatus getStatus() {
        return status;
    }

    public void setStatus(HttpStatus status) {
        this.status = status;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }
}
